<script type="text/javascript">
    jQuery(document).ready(function() {
    var sheepItForm = jQuery('#sheepItForm').sheepIt({
        separator: '',
        allowRemoveLast: true,
        allowRemoveCurrent: true,
        allowRemoveAll: true,
        allowAdd: true,
        allowAddN: true,
        maxFormsCount: 20,
        minFormsCount: 0,
        iniFormsCount: 1
    });
});
</script>
<script type="text/javascript">
    jQuery(document).ready(function() {
    var sheepItForm = jQuery('#sheepItFormA').sheepIt({
        separator: '',
        allowRemoveLast: true,
        allowRemoveCurrent: true,
        allowRemoveAll: true,
        allowAdd: true,
        allowAddN: true,
        maxFormsCount: 20,
        minFormsCount: 0,
        iniFormsCount: 1
    });
});
</script>
<script type="text/javascript">
    jQuery(document).ready(function() {
    var sheepItForm = jQuery('#sheepItFormB').sheepIt({
        separator: '',
        allowRemoveLast: true,
        allowRemoveCurrent: true,
        allowRemoveAll: true,
        allowAdd: true,
        allowAddN: true,
        maxFormsCount: 20,
        minFormsCount: 0,
        iniFormsCount: 1
    });
});
</script>
<script type="text/javascript">
           jQuery(document).ready(function(){
               // binds form submission and fields to the validation engine
               jQuery("#HojasrutaNuevotrabajoForm").validationEngine();
               jQuery( "#datepicker" ).datepicker();
           });
 </script>
<!-- Columns -->
<div id="cols" class="box"> 
    <!-- Aside (Left Column) -->
    <div id="aside" class="box">
        <div class="padding box"> 
            <!-- Logo (Max. width = 200px) -->
            <p id="logo"><a href="#"><?php echo $this->Html->image('logo.gif',
array('alt' => 'logo')) ?></a></p>
            <!-- Search -->
            <form action="#" method="get" id="search">
                <fieldset>
                    <legend>Busqueda</legend>
                    <p>
                        <input type="text" size="17" name="" class="input-text" />
                        &nbsp;
                        <input type="submit" value="BUSCAR" class="input-submit-02" />
                        <br />
                    </p>
                    <!-- /search-options -->
                </fieldset>
            </form>
        </div>
        <!-- /padding -->
 <ul class="box">
            <li><?php echo $this->Html->link('LISTA TRABAJOS', '/trabajos/index'); ?></li>
            <li id="submenu-active"><a href="#">EDITAR HOJA DE RUTA TRABAJO <?php echo $hojaruta[0]['Hojasruta']['trabajo_id'];?></a></li>
            
        </ul>    </div>
    <!-- /aside -->
    <hr class="noscreen" />
    <!-- Content (Right Column) -->
    <div id="content" class="box">
        <h1>Trabajo # <?php echo $hojaruta[0]['Hojasruta']['trabajo_id']; ?> </h1>
       <!-- Form -->
   <fieldset>
        <legend>Insertar datos del trabajo</legend>
        <?php echo $this->Form->create('Hojasruta'); ?>
        <table width="500" >
        	<tr>
	        	<td></td>
	        	<td colspan="2"><h2 align="center">HOJA DE RUTA</h2></td>
	        	<td colspan="3"><h2 align="center">FECHA:</h2><h3 align="center"><?php echo $hojaruta[0]['Hojasruta']['fecha']?></h3></td>
	        </tr>
        	<tr>
	        	<td>Cliente:</td>
	        	<td><?php echo $this->Form->text('nombre', array('value'=>$hojaruta[0]['Cliente']['nombre']));?></td>
        	</tr>
        	<tr>
	        	<td>Telefono:</td>
	        	<td><?php echo $this->Form->text('telefono',array('value'=>$hojaruta[0]['Cliente']['telefono']));?></td>
	        	<td >Celular:</td>
	        	<td><?php echo $this->Form->text('celular', array('value'=>$hojaruta[0]['Cliente']['celular']));?></td>
	        		<?php echo $this->Form->hidden('cliente_id',array('value'=>$hojaruta[0]['Cliente']['id']));?>
        	</tr>
        	<tr>
	       		<td colspan="4"><h2 align="center">TIPOS DE TRABAJO</h2></td> 	
        	</tr>
        	<tr>
        	<td colspan="4">
	        		<!-- sheepIt Form -->
                <div id="sheepItFormB">
            <?php foreach($trabajos as $t):?>
              <?php //debug($t)?>
            <!-- Form template-->
            <div id="sheepItFormB_template">
               <label for="sheepItFormB_#index#_phone">Descripcion: <span id="sheepItFormB_label"></span></label>
               <?php echo $this->Form->text(null, array('name'=>"data[Hojarutatipotrabajo][#index#][descripcion]", 'value'=>$t['Hojarutatipotrabajo']['descripcion']));?>
               <label for="sheepItFormB_#index#_phone">Tipo Trabajo: <span id="sheepItFormB_label"></span></label>
               <?php echo $this->Form->select(null, $tipotrabajos, array('name'=>"data[Hojarutatipotrabajo][#index#][tipotrabajo_id]", 'selected'=>'selected', 'value'=>$t['Hojarutatipotrabajo']['tipotrabajo_id']));?>
               <label for="sheepItFormB_#index#_phone">Sucursal: <span id="sheepItFormB_label"></span></label>
               <?php echo $this->Form->select(null, $sucursales, array('name'=>"data[Hojarutatipotrabajo][#index#][sucursal_id]",'selected'=>'selected', 'value'=>$t['Hojarutatipotrabajo']['sucursal_id'] ));?>
               <a id="sheepItFormB_remove_current">
			   <?php echo $this->Html->image('buttons/cross.png',array('class'=>'delete'))?>
               </a>
            </div>
            <!-- /Form template-->
            <?php endforeach;?>
                  <!-- No forms template -->
                  <div id="sheepItFormB_noforms_template">Sin Tipo de Trabajos</div>
                  <!-- /No forms template-->
                  <!-- Controls -->
                  <div id="sheepItForm_controls">
     <div id="sheepItFormB_add" class="btn form add"><a><span>A&ntilde;adir</span></a></div>
      <div id="sheepItFormB_remove_last" class="btn form remove"><a><span>Remover</span></a></div>
                 <div id="sheepItFormB_remove_all" class="btn form removeAll"><a><span>Remove todos</span></a></div>
                  </div>
                  <!-- /Controls -->
                </div>
                <!-- /shrteepIt Form -->
        	</td>
        	</tr>
        	<tr>
	        	<td colspan="4">Anverso: <?php echo $this->Form->checkbox('anverso');?>
	        	Reverso: <?php echo $this->Form->checkbox('reverso');?>
	        	Ambos: <?php echo $this->Form->checkbox('ambos');?></td>
        	</tr>
<table width="715">
        	<tr>
        		<td colspan="2"><h2 align="center">REQUERIMIENTO DE PRODUCTOS DEL INVENTARIO</h2></td>
        	</tr>
<tr>
<td colspan="5">        	
        		<!-- sheepIt Form -->
                <div id="sheepItFormA">
                 <?php foreach($inventariostrabajo as $e):?>
                  <!-- Form template-->
            <div id="sheepItFormA_template">
                    <label for="sheepItFormA_#index#_phone">Producto <span id="sheepItFormA_label"></span></label>
                    <?php echo $this->Form->select(null, $inventarios, array('name'=>"data[Inventariostrabajo][#index#][inventario_id]", 'selected'=>'selected', 'value'=>$e['Inventariostrabajo']['inventario_id']));?>
            
           <label for="sheepItForm_#index#_machine">Ancho<span id="sheepItFormA_label"></span></label>
           <?php echo $this->Form->text('ancho', array('name'=>"data[Inventariostrabajo][#index#][ancho]", 'value'=>$e['Inventario']['ancho']));?>
           <label for="sheepItForm_#index#_machine">Litros <span id="sheepItFormA_label"></span></label>
           <?php echo $this->Form->text('litros', array('name'=>"data[Inventariostrabajo][#index#][litros]", 'value'=>$e['Inventario']['litros']));?>

           <a id="sheepItFormA_remove_current">
				<?php echo $this->Html->image('buttons/cross.png',array('class'=>'delete'))?>
                    </a>
                  </div>

   <!-- /Form template-->
   <?php endforeach;?>
                  <!-- No forms template -->
                  <div id="sheepItFormA_noforms_template">Sin Inventario</div>
                  <!-- /No forms template-->
                   
                  <!-- Controls -->
                  <div id="sheepItForm_controls">
     <div id="sheepItFormA_add" class="btn form add"><a><span>A&ntilde;adir</span></a></div>
      <div id="sheepItFormA_remove_last" class="btn form remove"><a><span>Remover</span></a></div>
                 <div id="sheepItFormA_remove_all" class="btn form removeAll"><a><span>Remove todos</span></a></div>
                  </div>
              
                  <!-- /Controls -->
                   
                </div>
                <!-- /sheepIt Form -->
</td></tr>
               


	        	
        	
        <?php echo $this->Form->hidden('trabajo_id', array('value' => $hojaruta[0]['Hojasruta']['trabajo_id']));?>
          
          <tr>
             <td>Encargado:</td>
             <td>
                <?php echo $this->Session->read('nombre_usuario');?><?php echo $this->Form->hidden('usuario_id',array('value'=>$this->Session->read('usuario_id')));?>
             </td>
          </tr>
         
          <tr>
              <td>Empleados</td>  
              <td >
             <!-- sheepIt Form -->
                <div id="sheepItForm">
                 <?php foreach($empleadosasigandos as $ea):?>
                  <!-- Form template-->
                  <div id="sheepItForm_template">
                    <label for="sheepItForm_#index#_phone">Empleado <span id="sheepItForm_label"></span></label>
                    <!--<input id="sheepItForm_#index#_phone" name="person[phones][#index#][phone]" type="text"/>-->
                    <?php echo $this->Form->select(null, $empleados, array('name'=>"data[Empleadostrabajo][#index#][empleado_id]", 'selected'=>'selected', 'value'=>$ea['Empleado']['id']));?>
                    <label for="sheepItForm_#index#_machine">Maquina <span id="sheepItForm_label"></span></label>
                    <?php echo $this->Form->select(null, $maquinas, array('name'=>"data[Empleadostrabajo][#index#][maquinaria_id]", 'selected'=>'selected', 'value'=>$ea['Maquinaria']['id']));?>
                    <a id="sheepItForm_remove_current">
<?php echo $this->Html->image('buttons/cross.png',array('class'=>'delete'))?>
                    </a>
                  </div>
                  <!-- /Form template-->
                   <?php endforeach;?>
                  <!-- No forms template -->
                  <div id="sheepItForm_noforms_template">Sin empleados</div>
                  <!-- /No forms template-->
                   
                  <!-- Controls -->
                  <div id="sheepItForm_controls">
                    <div id="sheepItForm_add" class="btn form add"><a><span>A&ntilde;adir</span></a></div>
                    <div id="sheepItForm_remove_last" class="btn form remove"><a><span>Remover</span></a></div>
                    <div id="sheepItForm_remove_all" class="btn form removeAll"><a><span>Remove todos</span></a></div>
                 
                  </div>
              
                  <!-- /Controls -->
                   
                </div>
                <!-- /sheepIt Form -->
                   
              </td>
            
          </tr>
         
          <tr>
          
             <td class="t-right">
             <?php $option = array('Value' => 'modificar', 'class' =>
            "input-submit"); ?>
             <?php echo $this->Form->end($option); ?>
            </td>
          </tr>
       </table>
     
    </fieldset>
      
          
    <!-- /fin form --> 
        <div class="grid-buttons">
                     <!--<div class="title-grid"><span>Acciones</span></div>-->
            <div class="content-gird">
                    <div style="float: left;">
                        <input type="button" class="button" value="Atras" onclick="javascript:history.back();" /> 
                    </div>
                <div class="clear"> </div>
            </div>

        </div>

    </div>
    <!-- /content --> 

</div>
<!-- /cols -->
